package com.tomcov.server;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;



public class SessionHandler{
	
	public void setUserInSession(HttpServletRequest request,String Id){
		
		HttpSession session = request.getSession(true);
		session.setAttribute("UserById",Id);
	}
	
	public String getUserInSessionById(HttpServletRequest request){
		HttpSession session = request.getSession(false);
		return (String) session.getAttribute("UserById");
	}
	
	public void logout(HttpServletRequest request){
		HttpSession session = request.getSession(false);
		session.invalidate();
	}
}
